cmake_minimum_required(VERSION 3.10)

project(%{ProjectName})

set(CMAKE_CXX_STANDARD 17)

# build
find_package(dfm-extension)
if (NOT dfm-extension_FOUND)
    message(FATAL_ERROR "Could not find the libdfm-extension-dev, please download it first and then try again")
endif()

file(GLOB_RECURSE SRCS CONFIGURE_DEPENDS
    "./*.h"
    "./*.cpp"
)

add_library(${PROJECT_NAME} SHARED ${SRCS})
target_link_libraries(${PROJECT_NAME}
    PUBLIC ${dfm-extension_LIBRARIES}
    )

# install
include(GNUInstallDirs)
if(NOT DEFINED LIB_INSTALL_DIR)
    set(LIB_INSTALL_DIR ${CMAKE_INSTALL_FULL_LIBDIR})
endif()

if(NOT DEFINED DFM_EXT_PLUGIN_DIR)
    set(DFM_EXT_PLUGIN_DIR ${LIB_INSTALL_DIR}/dde-file-manager/plugins/extensions)
endif()
install(TARGETS ${PROJECT_NAME} LIBRARY DESTINATION ${DFM_EXT_PLUGIN_DIR})
